
img_orig1 = rgb2gray(imread('lena.jpg'));
c = 100 / log(1 + 255);
img_size = size(img_orig1);

for i = 1:img_size(1)
    for j = 1:img_size(2)
        s(i, j) = c * log(double(1 + img_orig1(i, j)));
    end
end

% 打印图片
figure();
subplot(1, 2, 1);
imshow(img_orig1);
title('Origin');
subplot(1, 2, 2);
imshow(uint8(s));
title('Compression');
